We have some modules that brought word tables into text attributes. These tables became formatted text in DOORS but do not render as tables when exported. We want to convert them to OLEs instead so they will export to Word as tables. This can be done manually by selected the entire text in DOORS for copying and then using PasteSpecial (formatted RTF) in Word. It becomes a table again. However I have been unable to duplicate this process using DXL. It always comes out as formatted text without borders and is not a table. What I am trying to do is copy from DOORS/paste special to Word as a table and then copy the table as an OLE and paste it in DOORS in place of the text. I've not been able to get the text into Word as a table except manually. Does anyone know how to do this with DXL? The DOORS text is all table so we don't have to worry about figuring what part of the attribute is the table and what part is just text. - David Bond David_G_Bond - Mon Sep 23 11:23:01 EDT 2013 |
Re: Word Table Conversion Hi David, for me (Office 2010) the following code seems to work, at least for the part of bringing the RTF table to the currently opened word document. However to bring it back it seems, you would need to do some different magic, possibly creating an empty word document in the object first, opening it and then pasting the contents inside it. I did not find a quick way, of bringing it back as a table to DOORS. Maybe that still helps, regards, Mathias OleAutoObj wd = oleGetAutoObject "Word.Application" olePut(wd, "visible", true); string sRich = richText (object 1)."Object Text" // This code seems to bring the richText as a table to Word setRichClip richText sRich OleAutoObj oleSelection oleGet (wd,"Selection", oleSelection) oleMethod(oleSelection, "Paste") |
Re: Word Table Conversion Thanks, Mathias, I was able to work it out by trying lots of different things until I got something that worked. A snippet is as follows:
setRichClip(richtText(o."Object Text") clear(objArgs) put(objArgs, "DataType",1) oleMethod(objSel, "PasteSpecial", objArgs)
where objSel is the Word selection object variable and objArgs is an OleAutoArgs variable Once it was in word I could select the table, copy it using "CopyAsPicture" and then use olePasteSpecial to paste it into the attribute. I found out that the object to paste into had to be the current object AND the selected object. If it was not current or not selected it wouldn't necessarily paste into the desired object. |